#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using i64=long long;
//1.integer overflow (1e5 * 1e5) (2e9 + 2e9)
//2.runtime error
//3.boundary condition
void solve()
{
    int n;
    cin >> n;
    vector< vector<char> > gridA(n + 1, vector<char>(n + 1)),gridB(n + 1, vector<char>(n + 1));
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1;j <= n; j++)
        {
            cin >> gridA[i][j];
        }
    }
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1;j <= n; j++)
        {
            cin >> gridB[i][j];
        }
    }
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1;j <= n; j++)
        {
            if(gridA[i][j] != gridB[i][j])
            {
                cout << i << ' ' << j;
                return;
            }
        }
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout<<fixed;
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
#ifdef LOCAL_DEFINE
    freopen("input.txt", "r", stdin);
#endif
    
#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}
